package com.hskn.hss.module.oilDevice.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.hskn.hss.core.annotation.DataScope;
import com.hskn.hss.core.page.TableDataInfo;
import com.hskn.hss.module.carviolation.entity.CarViolation;
import com.hskn.hss.module.oilDevice.domain.StateOilDevice;
import com.hskn.hss.module.oilDevice.ex.to.OilConsumeExcelTO;
import com.hskn.hss.module.oilDevice.to.*;
import com.hskn.hss.module.oilDevice.vo.MileageTableVO;
import com.hskn.hss.module.oilDevice.vo.OilConsumeVO;
import com.hskn.hss.module.oilDevice.vo.RefuelingSummaryECharsVO;
import com.hskn.hss.module.oilDevice.vo.StayReportTableVO;

import java.text.ParseException;
import java.util.List;

/**
 * 每日油量变化统计Service接口
 *
 * @author ruoyi
 * @date 2021-08-05
 */
public interface IStateOilDeviceService extends IService<StateOilDevice> {
    /**
     * 查询每日油量变化统计
     *
     * @param id 每日油量变化统计主键
     * @return 每日油量变化统计
     */
    StateOilDevice selectStateOilDeviceById(String id);

    /**
     * 查询每日油量变化统计列表
     *
     * @param stateOilDevice 每日油量变化统计
     * @return 每日油量变化统计集合
     */
    List<StateOilDevice> selectStateOilDeviceList(StateOilDevice stateOilDevice);

    List<List<Object>> selectStateOilDeviceForBTable(OilConsumeTO oilConsumeTO) throws ParseException;

    List<OilConsumeVO> selectStateOilDeviceForTTable(OilConsumeTableTO oilConsumeTableTO) throws ParseException;

    List<OilConsumeVO> selectStateOilDeviceTableByDepId(AddOilSummaryTableTO addOilSummaryTableTO) throws ParseException;

    List<OilConsumeVO> selectStateOilDeviceTableByOperType(AddOilSummaryTableTO addOilSummaryTableTO) throws ParseException;

    List<OilConsumeVO> selectStateOilDeviceTableByCarType(AddOilSummaryTableTO addOilSummaryTableTO) throws ParseException;

    List<List<Object>> selectStateOilDeviceOfOutForBTable(OilConsumeTO oilConsumeTO) throws ParseException;

    List<List<Object>> selectStateOilDeviceOfAddForBTable(OilConsumeTO oilConsumeTO) throws ParseException;

    List<List<Object>> selectMileageReportChars(MileageReportTableTO mileageReportCharsTO);

    TableDataInfo selectMileageReportTable(MileageReportTableTO mileageReportCharsTO);

    List<StayReportTableVO> stayReportTableDetailExcel(List<CarViolation> carViolationList);

    List<MileageTableVO> selectMileageReportTableExcel(MileageReportTableTO mileageReportCharsTO);

    RefuelingSummaryECharsVO getRefuelingSummaryECharsVO(AddOilSummaryTableTO addOilSummaryTableTO);


    List<StayReportTableVO> stayReportTableExcel(List<CarViolation> carViolationList);

    List<List<Object>> stayReportEChars(List<CarViolation> carViolationList);

    TableDataInfo stayReportTable(MileageReportTableTO mileageReportTableTO, List<CarViolation> carViolationList);

    TableDataInfo stayReportTableDetail(MileageReportTableTO mileageReportTableTO, List<CarViolation> carViolationList);

    //    private StayReportTableVO getStayReportTableVO(List<CarViolation> carViolationList,Map<String,
//            TlCarType> carTypeMap,Map<String,TlCar> carMap,Map<String, SysDepart> departMap){
//        String carName="";
//        String carTypeName="";
//        String depName="";
//        Integer stayCount=Objects.nonNull(carViolationList)?carViolationList.size():0;
//        BigDecimal stayTimeLength = BigDecimal.ZERO;
//        Date startDate=new Date();
//        Date endDate=new Date();
//        for(CarViolation carViolation:carViolationList){
//            startDate=carViolation.getViolationStartTime();
//            endDate=carViolation.getViolationEndTime();
//            if (StringUtils.isNotEmpty(carViolation.getCarTypeId())&&StringUtils.isEmpty(carTypeName)){
//                carTypeName=carTypeMap.get(carViolation.getCarTypeId()).getTypename();
//            }
//            if (StringUtils.isNotEmpty(carViolation.getCarId())&&StringUtils.isEmpty(carName)){
//                carName=carMap.get(carViolation.getCarId()).getCarnumber();
//            }
//            if (StringUtils.isNotEmpty(carViolation.getDepid())&&StringUtils.isEmpty(depName)){
//                depName=departMap.get(carViolation.getDepid()).getDepartName();
//            }
//            if (Objects.nonNull(startDate)&&Objects.nonNull(endDate)){
//                stayTimeLength=stayTimeLength.add(new BigDecimal(endDate.getTime()-startDate.getTime()));
//            }
//
//        }
//        return new StayReportTableVO(carName,carTypeName,depName,stayCount,StringUtils.s2date(stayTimeLength.longValue()));
//    }
    List<CarViolation> getCarViolationList(MileageReportTableTO mileageReportTableTO);

    List<OilConsumeVO> selectStateOilDeviceForExcel(OilConsumeExcelTO oilConsumeTableExcelTO) throws ParseException;
}
